home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1430 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: oxy.rust.net!usenet
  2. From: ebennett@rust.net
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Constructor?
  5. Date: Sun, 14 Jan 1996 01:06:36 GMT
  6. Organization: Rust Net - High Speed Internet in Detroit  810-642-2276
  7. Message-ID: <4d9abg$pj1@oxy.rust.net>
  8. References: <00001a80+00006b6c@msn.com>
  9. NNTP-Posting-Host: liv-20.rust.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. Pacu@msn.com (kenneth long) wrote:
  13.  
  14. >In a program example, I saw something similar to the following:
  15.  
  16. >        public:
  17. >            CString str;
  18. >                (etc..)
  19.  
  20.  
  21. >        Later, in a function, I saw: 
  22.  
  23. >        Function()
  24. >                    
  25. >            Cstring str;
  26. >                (etc..)
  27.  
  28. >In episode one, is it declaring str to be of CString type or is it 
  29. >constructed there? 
  30.  
  31. In the first case, str is being declared as a variable of type
  32. CString.  It will be constructed when the constructor for the class in
  33. which it is declared is executed.
  34.  
  35. >And in the second instance, inside of the 
  36. >function, is it being constructed or is it a variable of CString 
  37. >type? If this example is too vague, I will try to find the missing 
  38. >pieces, but I ask it in a general sense concerning the nature of 
  39. >constuctors and variable tpe declaration.
  40.  
  41. In the second case, a variable of type CString is being declared _and
  42. constructed_.  The constructor will execute when this statement is
  43. reached.
  44.  
  45. Earl
  46.  
  47.  
  48.